<?php
/**
 * Created by PhpStorm.
 * User: tyrone
 * Date: 2014/04/30
 * Time: 3:21 PM
 */

class Authentication {
    private $token;
    private $timestamp;
    private $nonce;

    public function __construct($initTimestamp,$initNonce){
        $this->token = "test123";
        $this->timestamp = $initTimestamp;
        $this->nonce = $initNonce;
    }

    public function getToken(){
        return $this->token;
    }

    public function getTimeStamp(){
        return $this->timestamp;
    }

    public function getNonce(){
        return $this->nonce;
    }

    public function getAuthString(){
        //add all three to a array then sort the array and return the appended string
        //$data[] = array($this->getToken(),$this->getTimeStamp(),$this->getNonce());
        $data[] = $this->getToken();
        $data[] = $this->getTimeStamp();
        $data[] = $this->getNonce();

        asort($data);

        $d = '';
        $authString = '';

        foreach($data as $d){
            $authString .= $d;
        }

        return $authString;
    }

}